-
Notifications
You must be signed in to change notification settings - Fork 178
Support aggregation/window commands with dynamic fields #4743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/permissive
Are you sure you want to change the base?
Support aggregation/window commands with dynamic fields #4743
Conversation
...t/src/test/java/org/opensearch/sql/calcite/standalone/CalciteDynamicFieldsAggregationIT.java
Show resolved
Hide resolved
...t/src/test/java/org/opensearch/sql/calcite/standalone/CalciteDynamicFieldsAggregationIT.java
Outdated
Show resolved
Hide resolved
...t/src/test/java/org/opensearch/sql/calcite/standalone/CalciteDynamicFieldsAggregationIT.java
Outdated
Show resolved
Hide resolved
common/src/main/java/org/opensearch/sql/common/utils/DebugUtils.java
Outdated
Show resolved
Hide resolved
...est/src/test/java/org/opensearch/sql/calcite/standalone/CalciteDynamicFieldsTimechartIT.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/calcite/CalciteRelNodeVisitor.java
Outdated
Show resolved
Hide resolved
33bab3f to
6b2e491
Compare
|
Updated to utilize type coercion. |
| if (!context.fieldBuilder.isFieldSpecificType(byFieldName)) { | ||
| throw new IllegalArgumentException( | ||
| String.format( | ||
| "By field `%s` needs to be specific type. Please cast explicitly.", byFieldName)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we cast to string for groupBy field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized timechart requires bigger change due to type assigned to span function, which prevents automatic type coercion work properly.
Let me address this in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found simpler way to solve the problem, and included the change in this PR.
44e2d10 to
0e2d036
Compare
| } else if (SqlTypeUtil.isCharacter(fieldType)) { | ||
| // if first argument is string, consider it as timestamp | ||
| ScalarFunctionImpl function = | ||
| (ScalarFunctionImpl) | ||
| ScalarFunctionImpl.create( | ||
| Types.lookupMethod( | ||
| SpanFunction.class, | ||
| "evalTimestamp", | ||
| String.class, | ||
| int.class, | ||
| String.class)); | ||
| return function.getImplementor().implement(translator, call, RexImpTable.NullAs.NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could u explain it more on this, "// if first argument is string, consider it as timestamp"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
| projectDynamicFieldAsString(node.getBinExpression(), context); | ||
| projectDynamicFieldAsString(node.getByField(), context); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it required for all visitor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could u add a test in CalciteDynamicFieldsTimechartIT to help understand what is correspond logical plan / sql
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added CalcitePPLDynamicFieldsTest.java for spark SQL. Added explains in IT.
Signed-off-by: Tomoyuki Morita <[email protected]>
Signed-off-by: Tomoyuki Morita <[email protected]>
Signed-off-by: Tomoyuki Morita <[email protected]>
Signed-off-by: Tomoyuki Morita <[email protected]>
Signed-off-by: Tomoyuki Morita <[email protected]>
Signed-off-by: Tomoyuki Morita <[email protected]>
Signed-off-by: Tomoyuki Morita <[email protected]>
Signed-off-by: Tomoyuki Morita <[email protected]>
Signed-off-by: Tomoyuki Morita <[email protected]>
d6acee2 to
d552010
Compare
This PR is for feature branch
feature/permissiveDescription
Related Issues
Permissive mode RFC: #4349
Dynamic fields RFC: #4433
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.